home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qbtools1.arc
/
AEGETFIL.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-01-17
|
2KB
|
77 lines
rem $linesize:132
rem $title:'Application Engineer Standard Routines'
rem $subtitle:'Get all file names matching wildcards'
' Include the COMMON values
rem $include:'AESHARED.BAS'
' Changed to ensure that no *garbage* is returned
sub getfiles(fl$(1),flnm$,ext$,count%) static
dim inreg%(8),outreg%(8) ' registers for dos calls
fl%=0% ' initial file count
axreg%=0% ' as suggested by the ms people ...
bxreg%=1%
cxreg%=2%
dxreg%=3%
bpreg%=4%
sireg%=5%
direg%=6%
flreg%=7%
dta$=string$(256,0)
fcb$=string$(44,0) ' extended file control block
inreg%( axreg% )=&h1a00
inreg%( dxreg% )=sadd(dta$)
call int86(&h21, varptr(inreg%(0)) , varptr(outreg%(0)) ) ' set dta
mid$(fcb$,1,1)=chr$(&hff)
mid$(fcb$,7,1)=chr$(0)
mid$(fcb$,9,8)=flnm$+string$(8-len(flnm$),"?")
mid$(fcb$,17,3)=ext$+string$(3-len(ext$),"?")
inreg%( axreg% )=&h1100 ' get first match
inreg%( dxreg% )=sadd(fcb$)
call int86(&h21 , varptr(inreg%(0)) , varptr(outreg%(0)) )
p1$=mid$(dta$,9,8)
p2$=mid$(dta$,17,3)
call ctrl.trim(p1$)
call ctrl.trim(p2$)
if len(p2$) then p2$="."+p2$
fl$=p1$+p2$
tp$=""
while tp$<>fl$
fl%=fl%+1%
if fl%>ubound(fl$,1) then
call ae.error("Error in getfiles sub program : too many files")
end
end if
fl$(fl%)=fl$
tp$=fl$
inreg%( axreg% )=&h1a00
inreg%( dxreg% )=sadd(dta$)
call int86(&h21, varptr(inreg%(0)) , varptr(outreg%(0)) ) ' set dta
inreg%( axreg% )=&h1200
inreg%( dxreg% )=sadd(fcb$)
call int86(&h21 , varptr(inreg%(0)) , varptr(outreg%(0)) )
p1$=mid$(dta$,9,8)
p2$=mid$(dta$,17,3)
call trim(p1$)
call trim(p2$)
if len(p2$) then p2$="."+p2$
fl$=p1$+p2$
wend
if fl$(fl%)="" then
fl%=fl%-1%
end if
count%=fl%
end sub